package com.open.fei.listener;

import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.apache.rocketmq.spring.core.RocketMQPushConsumerLifecycleListener;
import org.springframework.stereotype.Component;

/**
 * 重试接收
 * @author zhaoYuFei
 */
@Component
@RocketMQMessageListener(topic = "powernodes",
        consumerGroup = "TrysMsg",
        consumeMode = ConsumeMode.ORDERLY
)
public class TrysMsgListener  implements RocketMQListener<String> , RocketMQPushConsumerLifecycleListener {


    @Override
    public void onMessage(String s) {

    }

    @Override
    public void prepareStart(DefaultMQPushConsumer defaultMQPushConsumer) {
        defaultMQPushConsumer.setMaxReconsumeTimes(3);
    }
}
